package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.mapper.MemberMapper;
import com.itheima.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Version: V1.0
 */
@Service(interfaceClass = MemberService.class)
@Transactional
public class MemberServiceImpl implements MemberService{
    @Autowired
    private MemberMapper memberMapper;
    @Override
    public List<Integer> findMemberCountByMonths(List<String> months) {
        List<Integer> list=new ArrayList<>();
        for (String month : months) {
            String date=month+".31";
            Integer count = memberMapper.findMemberCountBeforeDate(date);
            list.add(count);
        }
        return list;
    }
}
